package edu.lingnan.lingnanblog.service;

import edu.lingnan.lingnanblog.entity.Blogger;
import feign.hystrix.FallbackFactory;

/**
 * @author wuyuan
 * @since 2020-06-15 15:33
 *
 * Blogger 类的服务降级处理类(客户端)
 */
public class BloggerClientServiceFallbackFactory implements FallbackFactory<BloggerClientService> {
    @Override
    public BloggerClientService create(Throwable throwable) {
        return new BloggerClientService() {
            @Override
            public Blogger selectOne(int id) {
                return new Blogger()
                        .setId(id)
                        .setName("该用户不存在！")
                        .setSign("来自客户端的服务降级~~~");
            }

            @Override
            public Blogger login(String name, String password) {
                return null;
            }

            @Override
            public boolean reg(Blogger bean) {
                return false;
            }

            @Override
            public Blogger getByName(String name) {
                return null;
            }

            @Override
            public boolean save(Blogger blogger) {
                return false;
            }
        };
    }
}
